Added project

This commit is contained in:
2023-06-11 02:13:14 +03:00
parent bf61f13ded
commit d006b1e11e
68 changed files with 15739 additions and 2 deletions

View File

@@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/*
Author: Alexandrov Alexander Alexandrovich
Date: 25/10/2019
Script that implement collect of coins by player's character
*/
public class CoinCollect : MonoBehaviour {
private GameController gameController;
void Start() {
GameObject gameControllerObject = GameObject.FindGameObjectWithTag("game_controller");
if (gameControllerObject != null) {
gameController = gameControllerObject.GetComponent<GameController>();
} else {
Debug.Log("Cannot find 'GameController' script!");
}
}
private void OnTriggerEnter2D(Collider2D other) {
if (other.gameObject.CompareTag("Player")) {
gameController.AddScore(1);
Destroy(gameObject);
}
}
}