コード例 #1
0
ファイル: Alien.cs プロジェクト: hoduc/SpaceInvader
    //driving index by an array for example

    // void Start(){
    //  Init ();
    // }

    public override void EntUpdate()
    {
        //Debug.Log("base shootable=" + base.shootable);
        //Debug.Log("alien Shootable:" + this.shootable);
        if (shootable && !isShooting)
        {
            //Debug.Log("Create bomb");
            Ent2D.CreateBomb(child, this, -DIST_Y, UP_BOUND_Y /*7.79f*/, DOWN_BOUND_Y /*-7.79f*/, false);
        }
        if (startMoving && !MoveIndex(index))
        {
            index = (index + 1) % 2;
        }
    }
コード例 #2
0
ファイル: Boss.cs プロジェクト: hoduc/SpaceInvader
    //testing movement
//	void Start(){
//		Init(transform.position.x, transform.position.x + diameterX, transform.position.y + diameterY/2.0f, transform.position.y - diameterY/2.0f);
//		if (dev) {
//			CreateCirc (new Vector3 (transform.position.x, transform.position.y, transform.position.z), Color.green); //lbx
//			CreateCirc (new Vector3 (transform.position.x + diameterX, transform.position.y, transform.position.z), Color.green); //rbx
//			CreateCirc (new Vector3 (transform.position.x + diameterX/2.0f, transform.position.y + diameterY/2.0f, transform.position.z), Color.green); //uby
//			CreateCirc (new Vector3 (transform.position.x + diameterX/2.0f, transform.position.y - diameterY/2.0f, transform.position.z), Color.green); //dby
//		}
//	}

    public override void EntUpdate()
    {
        if (shootable)
        {
            //Debug.Log("Create bomb");
            Ent2D.CreateBomb(child, this, -DIST_Y, 7.79f, -7.79f, false);
        }
        if (startMoving && !MoveIndex(index))
        {
            if (index >= indexSize)
            {
                return;
            }
            index = (index + 1) % indexSize;
        }
    }
コード例 #3
0
ファイル: Player.cs プロジェクト: hoduc/SpaceInvader
    // Update is called once per frame
    public override void EntUpdate()
    {
        if (isZombie)
        {
            return;
        }
        //not dead
        //Debug.Log ("width left:" + Camera.main.ScreenToWorldPoint (new Vector3 (-Screen.width, 0.0f, 0.0f)).x);
        if (Input.GetMouseButtonDown(0) && transform.position.x < ScreenX())
        {
            moveRightWrapper();
        }
        else if (Input.GetMouseButtonDown(0) && transform.position.x > ScreenX())
        {
            moveLeftWrapper();
        }

        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            moveRightWrapper();
        }

        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            moveLeftWrapper();
        }

        if (Input.GetKeyDown(KeyCode.D))
        {
            TakeDamageEvent.Invoke();              //die
        }

        if (/*Input.GetKeyDown (KeyCode.Space) &&*/ !isShooting && shootable)           //autofire
        {
            Ent2D.CreateBomb(child, this, DIST_Y, UP_BOUND_Y, -DOWN_BOUND_Y);
        }
    }