Exemple #1
0
    public void SelectMonster(MonsterFSM _monsterFSM)
    {
        hud.SetActive(true);

        monsterFSM = _monsterFSM;

        figure.sprite = monsterFSM.monsterSprite.sprite;
        lvText.text = monsterFSM.monsterLevel.ToString();
        nameText.text = monsterFSM.monsterName;
        if (monsterFSM.elite > 1)
        {
            elite1.enabled = true;
            if (monsterFSM.elite > 2)
            {
                elite2.enabled = true;
            }
        }
        else
        {
            elite1.enabled = false;
            elite2.enabled = false;
        }

        hpBar.fillAmount = 1.0f;
        spBar.fillAmount = 0.0f;
    }
Exemple #2
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hitInfo;

            if (Physics.Raycast(ray, out hitInfo, 100.0f, layerMask))
            {
                int layer = hitInfo.collider.gameObject.layer;

                if (layer == LayerMask.NameToLayer("Click"))
                {
                    movePoint.transform.position = hitInfo.point;
                    movePoint.SetActive(true);
                    attackPoint.SetActive(false);
                    agent.SetDestination(movePoint.transform.position);
                    SetState(CharacterState.Run);
                    agent.stoppingDistance = 0;
                }
                else if (layer == LayerMask.NameToLayer("Monster"))
                {
                    attackPoint.transform.SetParent(hitInfo.transform);
                    attackPoint.transform.localPosition = Vector3.zero;
                    attackPoint.SetActive(true);
                    movePoint.SetActive(false);
                    agent.SetDestination(attackPoint.transform.position);
                    SetState(CharacterState.AttackRun);
                    agent.stoppingDistance = attackRange;
                    monsterFSM             = hitInfo.transform.GetComponent <MonsterFSM>();
                }
            }
        }
    }
 public override void onCreate(EntityInfo data)
 {
     base.onCreate(data);
     fsm = new MonsterFSM(this);
     onChangeState(StateType.spawn);
     treeAI = new MonsterBTAI();
     dt     = WorkingDataFactroy.createData(this);
 }
Exemple #4
0
    //public static void Main(string[] args)
    //{
    public void Start()
    {
        //androidPlugin = GameObject.Find("NetworkManager").GetComponent<AndroidPlugin>();


        Debug.Log("네트워크 스크립트");
        //joy = GameObject.Find("JoystickBackGround").GetComponent<JoyStick>();
        Debug.Log("네트워크 스크립트2");
        singleton = this;

        player    = GameObject.FindWithTag("Player").GetComponent <Transform>();
        playerAni = GameObject.FindWithTag("Player").GetComponent <PlayerAni>();

        player2   = GameObject.FindWithTag("RemotePlayer").GetComponent <Transform>();
        remoteAni = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteAni>();
        //rigidboby = GameObject.FindWithTag("RemotePlayer").GetComponent<Rigidbody>();

        //myId = androidPlugin.text;
        //myId = "Nova";
        //myTeam = "1";
        //myId = "Nova";

        //Debug.Log("내 아이디: "+ myId);

        //Connected();
        //Send(myId + "," + "myTeamCall");
        //ConnectToTcpServer();
        //clientSocket.Close();
        //myId = PlayerPrefs.GetString("myId");
        exampleClass = GameObject.Find("IDManager").GetComponent <ExampleClass>();
        myId         = exampleClass.myId;
        Debug.Log("Unity Network Script myId: " + myId);
        //Connected();
        //Send(myId);
        //ConnectToTcpServer();

        playerFsm  = GameObject.FindWithTag("RemotePlayer").GetComponent <PlayerFSM>();
        playerFsm2 = GameObject.FindWithTag("Player").GetComponent <PlayerFSM2>();

        remoteFSM = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteFSM>();

        monsterFSM = GameObject.Find("Spider").GetComponent <MonsterFSM>();


        Connected();
        Send(myId);
        ConnectToTcpServer();

        skillOne = GameObject.Find("TaiLungSpell1").GetComponent <SkillButton>();
        //StartCoroutine(PlayerSet());
    }
Exemple #5
0
    public IEnumerator InputMouse()
    {
        while (true)
        {
            if (Input.GetMouseButton(0) || Input.GetMouseButtonDown(0))
            {

                Vector2 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                Vector3 clickPos = pos;
                Ray2D ray = new Ray2D(pos, Vector2.zero);
                RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction, 15.0f);

                if (hit.collider)
                {
                    monsterFSM = hit.collider.GetComponent <MonsterFSM>();
                    if (isMelee)
                    {

                        meleeAttack(clickPos);

                    }
                    else
                    {
                        rangeAttack(clickPos);
                    }

                }
                else if (isMelee)
                {
                    meleeAttack(clickPos);
                }
                else if (!isMelee)
                {
                    rangeAttack(clickPos);

                }

                // a++;
                if (a > 36)
                {
                    a = 1;

                }

            }

            yield return new WaitForSeconds(1 / attackSpeed);
        }
    }
Exemple #6
0
 /////////////////////////////////////////////////////////////////////////////////////
 void Awake()
 {
     mFSM = GetComponent <MonsterFSM>();
 }
Exemple #7
0
 void Awake()
 {
     _manager = GetComponent <MonsterFSM>();
 }