-
Notifications
You must be signed in to change notification settings - Fork 0
/
Next_turn_Act.cs
56 lines (52 loc) · 1.61 KB
/
Next_turn_Act.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Next_turn_Act : MonoBehaviour
{
Monster_behavior next_t;
public Renderer rend;
AttackButton attackButton;
public GameObject attack_Button;
public GameObject monster_area;
BoxCollider2D M_collision_enabled;
public GameObject monster;
MonsterStatus m_status;
void Start()
{
M_collision_enabled=monster_area.GetComponent<BoxCollider2D>();
M_collision_enabled.enabled=false;
rend = GetComponent<Renderer>();
rend.enabled = true;
monster =GameObject.FindGameObjectWithTag("Enemy");
next_t=monster.GetComponent<Monster_behavior>();
attackButton=attack_Button.GetComponent<AttackButton>();
m_status=monster.GetComponent<MonsterStatus>();
m_status.attack=false;
}
void FixedUpdate()
{
if(m_status.attack)
{
next_t.next_turn++;
attackButton.ispressed=false;
attackButton.isfinished=false;
attackButton.other=false;
attackButton.firts_pos=false;
attackButton.flag=true;
M_collision_enabled.enabled=true;
next_t.isattacked=true;
m_status.attack=false;
}
}
void OnMouseDown()
{
next_t.next_turn++;
attackButton.ispressed=false;
attackButton.isfinished=false;
attackButton.other=false;
attackButton.firts_pos=false;
attackButton.flag=true;
M_collision_enabled.enabled=true;
next_t.isattacked=true;
}
}