Inheritance: MonoBehaviour
    /// <summary>
    /// コントローラの初期化
    /// </summary>
    private void initGorillaController()
    {
        gameManager          = GameObject.FindObjectOfType <GameManager>();
        playerMoveController = GameObject.Find(PathMaster.DOG_MOVE_CONTROLLER).GetComponent <PlayerMoveController>();
        attackController     = GameObject.Find(PathMaster.ATTACK_CONTROLLER).GetComponent <AttackController>();
        sweetController      = GameObject.Find(PathMaster.SWEET_CONTROLLER).GetComponent <SweetController>();
        sensorController     = GameObject.Find(PathMaster.SENSOR_CONTROLLER).GetComponent <SensorController>();
        skillController      = GameObject.Find(PathMaster.SKILL_CONTROLLER).GetComponent <SkillController>();
        mainCamera           = Camera.main;
        CameraController cameraController = mainCamera.GetComponent <CameraController>();

        cameraController.Player = this.gameObject;
        cameraController.InitCameraController();
        cameraAnimator = mainCamera.GetComponent <Animator>();

        this.FixedUpdateAsObservable()
        .Where(_ => isInBattleState())
        .Subscribe(x => playerBehavior());
        this.FixedUpdateAsObservable()
        .Where(x => attackController.GetAttackable() && isInBattleState())
        .Subscribe(_ => gorillaAttack());
        this.FixedUpdateAsObservable()
        .Where(x => sweetController.GetUsable() && isInBattleState())
        .Subscribe(_ => useSweet());
        this.FixedUpdateAsObservable()
        .Where(x => sensorController.GetUsable() && isInBattleState())
        .Subscribe(_ => useSensor());
        this.FixedUpdateAsObservable()
        .Where(x => skillController.GetSkillUsable() && isInBattleState())
        .Subscribe(_ => useSkill());
    }
示例#2
0
 public void Start()
 {
     ic   = GetComponent <InputController>();
     ac   = GetComponent <AttackController>();
     pmc  = GetComponent <PlatformMovementController>();
     rend = GetComponent <SpriteRenderer>();
 }
 private void Start()
 {
     _attackController = GetComponent <AttackController>();
     _activeBars       = new List <HorizontalBar>();
     SetupEventListeners();
     SetupInitialStage();
 }
示例#4
0
 void Start()
 {
     ObjectRegistry.AddUnit(gameObject, isEnemy);
     agent            = GetComponent <NavMeshAgent>();
     attackController = GetComponent <AttackController>();
     FindTargetPerTime();
 }
示例#5
0
    public override void Think(Thinker thinker)
    {
        DrakeController    drake     = thinker.Remember <DrakeController>("drake");
        MovementController mc        = thinker.Remember <MovementController>("movement");
        AttackController   at        = thinker.Remember <AttackController>("attack");
        Vector2            moveInput = thinker.Remember <Vector2>("moveInput");

        if (!mc.IsGrounded)
        {
            return;
        }

        if (moveInput.sqrMagnitude <= 0)
        {
            moveInput = new Vector2(1, 0);
        }
        else if (mc.IsAtWall() || mc.IsAtEdge())
        {
            moveInput.x *= -1;
        }

        thinker.Remember("moveInput", moveInput);
        drake.Walk(moveInput);

        if (target.Value != null && at.AttackCollider.bounds.Intersects(target.Value.bounds))
        {
            drake.Attack();
        }
    }
示例#6
0
    public virtual void CastLocalAttack(Vector2 startPosition, Vector2 targetPosition)
    {
        AttackController attack = GetAttack();

        attack.Initialize(this, AttackController.MoveType.Target);
        attack.SetMovement(startPosition, targetPosition, attackSpeed);
    }
示例#7
0
    public ADController(AttackController attackController, DefenseController defenseController)
    {
        this.state = ADStateAlt.None;

        this.attackController  = attackController;
        this.defenseController = defenseController;
    }
示例#8
0
    // Use this for initialization
    void Start()
    {
        if (PlayerNumber < 1 || PlayerNumber > 4)
        {
            Debug.LogError("Don't do that again. -- Victor");
        }

        movementController  = GetComponent <MovementController>();
        jumpThrowController = GetComponent <JumpThrowController>();
        attackController    = GetComponent <AttackController>();
        landingLogic        = GetComponent <LandingLogic>();
        rigid = GetComponent <Rigidbody>();
        floor = GetComponentInChildren <FloorCollider>();

        Transform indicatorTransform = transform.Find("Indicator");

        if (indicatorTransform == null)
        {
            Debug.LogError("Please attach an Indicator to the player (both human and robot)!");
        }
        else
        {
            indicator = indicatorTransform.gameObject;
        }

        startPosition = transform.position;
    }
示例#9
0
    protected override void Start()
    {
        base.Start();
        rend = GetComponent <Renderer>();

        pathfinder       = GetComponent <NavMeshAgent> ();
        attackController = GetComponent <AttackController>();

        if (GameObject.FindGameObjectWithTag("Player") != null)
        {
            currentState = State.Chasing;
            hasTarget    = true;

            target                = GameObject.FindGameObjectWithTag("Player").transform;
            targetEntity          = target.GetComponent <LivingEntity> ();
            targetEntity.OnDeath += OnTargetDeath;

            myCollisionRadius     = GetComponent <CapsuleCollider> ().radius;
            targetCollisionRadius = target.GetComponent <CapsuleCollider> ().radius;

            StartCoroutine(UpdatePath());
            StartCoroutine(Attack());

            spawner = FindObjectOfType <Spawner>();
            GetComponent <LivingEntity>().OnDeath += spawner.OnEnemyDeath;
            GetComponent <LivingEntity>().OnDeath += AddPoints;
        }
    }
    // Update is called once per frame
    void Update()
    {
        rb.velocity = new Vector3(Input.GetAxis("Horizontal") * speed,
                                  rb.velocity.y,
                                  Input.GetAxis("Vertical") * speed);

        rb.rotation = cameraObject.transform.rotation;

        if (Input.GetAxis("Fire1") > 0.0f)
        {
            chargeTime += Time.deltaTime;
            if (chargeTime >= chargeMax)
            {
                chargeTime = chargeMax;
            }
        }

        if ((Input.GetAxis("Fire1") <= 0.0f) && (swing == null) && (chargeTime > 0.0f))
        {
            swing        = Instantiate(attack, rb.position, rb.rotation); // create an attack hitbox, save as swing
            swingControl = swing.GetComponent <AttackController>();       // get the cotroller script of the attack
            if (swingControl != null)
            {
                swingControl.knockback = (chargeTime / chargeMax) * knockbackMax;
                swingControl.duration  = attackDuration;
            }
            chargeTime = 0.0f; // reset charge time
        }

        if (swing != null)
        {
            swing.transform.position = rb.position;
        }
    }
示例#11
0
 protected virtual void Start()
 {
     // look up parent by health script, anything with a gun should have hp
     player = gameObject.GetComponentInParent<Health>().gameObject;
     teamId = player.GetComponent<TeamMember> ().teamId;
     atkController = player.GetComponent<AttackController> ();
 }
示例#12
0
        // Use this for initialization
        void Start()
        {
            Light2D torch = GameObject.Find("Torch").GetComponent <Light2D>();

            if (torch == null)
            {
                throw new ArgumentNullException("Torch is not attached to player!");
            }
            _animator = GetComponent <Animator>();
            if (_animator == null)
            {
                throw new ArgumentNullException("Animator is not associated with player!");
            }
            _sanityManager = GetComponent <SanityManager>();
            if (_sanityManager == null)
            {
                throw new ArgumentNullException("Sanity manager is not associated with player!");
            }
            _controller2D = GetComponent <MovementController2D>();
            if (_controller2D == null)
            {
                throw new ArgumentNullException("Controller 2D is not associated with player!");
            }
            _attackController = GetComponent <AttackController>();
            if (_attackController == null)
            {
                throw new ArgumentNullException("Attack controller is not associated with player!");
            }

            _instrumentDisabled = SharedInfo.LostInstrument;
            _torchDisabled      = SharedInfo.LostTorch;

            _torch = torch;
            DeactivateTorch();
        }
示例#13
0
 public void OnSceneGUI()
 {
     c             = this.target as AttackController;
     Handles.color = Color.green;
     Handles.DrawWireDisc(c.transform.position, Vector3.forward, c.attackRadius);
     // radius
 }
示例#14
0
 void Start()
 {
     myTeamId = GetComponent<TeamMember> ().teamId;
     atkController = GetComponent<AttackController> ();
     weapon = atkController.currentWeapon;
     myRenderer = GetComponentInChildren<MeshRenderer> ();
 }
示例#15
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Attack")
     {
         AttackController attack = collision.gameObject.GetComponent <AttackController>();
     }
 }
示例#16
0
    void checkifhit(Collider c)
    {
        if (!entitiesHit.Contains(c.transform.root.gameObject))
        {
            //add them to the list
            entitiesHit.Add(c.transform.root.gameObject);

            //check sibling index to see if we hit head, body or legs

            if (c.transform.GetSiblingIndex() == 0)
            {
                //        Debug.Log("Hit head");
                damage = 3;
            }
            else if (c.transform.GetSiblingIndex() <= 2)
            {
                //      Debug.Log("Hit Body");
                damage = 2;
            }
            else
            {
                //    Debug.Log("hit legs");
                damage = 1;
            }

            ctrl          = c.transform.root.GetComponent <AttackController>();
            ctrl.enemyRef = this;
            ctrl.HandleBlocks((attacktype() + damage + damageCalculator()) * 10f);
            empty = false;
            return;
        }
        empty = true;
    }
示例#17
0
 // Use this for initialization
 void Start()
 {
     attackController   = GetComponent <AttackController>();
     equipmentHandler   = GetComponent <EquipmentHandler>();
     movementController = GetComponent <MovementController>();
     uicontroller       = GameObject.FindObjectOfType <UIController>() as UIController;
     health             = maxHealth;
 }
 // Use this for initialization
 void Start()
 {
     rigidbody        = GetComponent <Rigidbody2D>();
     lifeController   = GetComponent <LifeController>();
     attackController = GetComponent <AttackController>();
     animator         = GetComponent <Animator>();
     navMeshAgent     = GetComponentInParent <NavMeshAgent>();
 }
 // Use this for initialization
 void Start()
 {
     attackController = gameObject.transform.Find(weaponPath).GetChild(0).GetComponent <AttackController>(); //inicializar valores
     if (attackController == null)
     {
         Debug.Log("ERRO: Objeto de ataque nao encontrado!");                           //para melhor controle e teste
     }
 }
示例#20
0
 public Submarine(INavigator navigator, IEnemyTracker enemyTracker, IConsole console,
                  AttackController attackController, ChargeController chargeController)
 {
     _navigator        = navigator;
     _enemyTracker     = enemyTracker;
     _console          = console;
     _attackController = attackController;
     _chargeController = chargeController;
 }
示例#21
0
    // -------------------------------------------------
    // FireAttack
    // -------------------------------------------------
    private void FireAttack()
    {
        AttackController fireball = DoAttack("Fireball");

        fireball.transform.parent = null;
        fireball.gameObject.AddComponent <Rigidbody2D>();
        fireball.GetComponent <Rigidbody2D>().velocity = getHitVector(this.launchForce, this.launchAngle, -TargetDirection());
        fireballs.Add(fireball);
    }
示例#22
0
    public AttackController DoAttack(string name)
    {
        AttackController spawnedAttack = Instantiate(this.attack, this.transform).GetComponent <AttackController>();

        spawnedAttack.isAerial = false;
        spawnedAttack.SetAttack(FindAttack(name));
        attacking = true;
        return(spawnedAttack);
    }
示例#23
0
 // Use this for initialization
 void Start()
 {
     Transform parent = transform;
     while (atkCtrl == null) {
         parent = parent.parent;
         atkCtrl = parent.GetComponent<AttackController>();
     }
     game = GameObject.FindWithTag("GameController").GetComponent<GameController>();
 }
示例#24
0
        public void addNormalAttack(bool _useAi)
        {
            AiController.SetAi(_useAi);
            var vo = new ActionVo {
                ActionType = Actions.ATTACK
            };

            AttackController.AddAttackList(vo);
        }
示例#25
0
    // Use this for initialization
    void Start()
    {
        GameObject p = GameObject.FindGameObjectWithTag("Player");
        mCtrl = p.GetComponent<MovementController>();
        aCtrl = p.GetComponent<AttackController>();
        eCtrl = p.GetComponent<EquipmentController>();

        game = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>();
    }
 // Use this for initialization
 void Start()
 {
     moveController = GetComponent<MoveController>();
     animator = GetComponent<Animator>();
     attackController = GetComponent<AttackController>();
     crowdControllable = GetComponent<CrowdControllable>();
     health = GetComponent<Health>();
     player = GetComponent<Player>();
 }
示例#27
0
    void Start()
    {
        controller       = GetComponent <Controller2D>();
        attackController = GetComponent <AttackController>();

        if (target == null)
        {
            target = Player.Instance.transform;
        }
    }
示例#28
0
    void Start()
    {
        attackController = GetComponent <AttackController>();

        if (randomEquipment)
        {
            equippedWeapon = weaponList[Random.Range(0, weaponList.Length)];
            equippedShield = shieldList[Random.Range(0, shieldList.Length)];
        }
    }
示例#29
0
 public void TryToEquip(GameObject wielder)
 {
     if (!equipped)
     {
         transform.Find("PickUpBox").collider.enabled = false;
         equipped = true;
         atkCtrl = wielder.GetComponent<AttackController>();
         wielder.GetComponent<EquipmentController>().Equip(this.gameObject);
     }
 }
示例#30
0
 void Awake()
 {
     faceDirection    = Vector2.right;
     renderer         = GetComponent <SpriteRenderer> ();
     rigidbody        = GetComponent <Rigidbody2D> ();
     attackController = GetComponent <AttackController> ();
     originalColor    = renderer.color;
     trail            = GetComponent <TrailRenderer> ();
     anim             = GetComponent <Animator> ();
 }
示例#31
0
    void Start()
    {
        _ActivePlayer     = GameObject.Find("Low Poly Warrior");
        _Hud              = GameObject.FindObjectOfType <HUD>();
        _playerController = GameObject.FindObjectOfType <PlayerController>();
        _attackController = _ActivePlayer.GetComponent <AttackController>();

        //    Button _buttonTemplate = gameObject.transform.Find("HUD/RightClickMenu/ButtonListViewport/ButtonListContent/Button").GetComponent<Button>();
        //    //_buttonTemplate = Resources.Load("HUD/RightClickMenu/ButtonListViewport/ButtonListContent/ButtonListContent") as GameObject;
    }
示例#32
0
 private void Start()
 {
     movementController  = this.GetComponent <MovementController>();
     animationController = this.GetComponent <AnimationController>();
     attackController    = this.GetComponent <AttackController>();
     CalculatePhysics(jumpHeight, timeToJumpApex);
     if (fallingAnimationThreshold > gravity)
     {
         Debug.Log("Falling animation threshhold is too small");
     }
 }
示例#33
0
    void OnCollisionStay(Collision col)
    {
        AttackController attackController = col.gameObject.GetComponent <AttackController>();

        if (attackController != null && attackController.isAttacking)
        {
            damage = (int)(Math.Pow(attackController.attackLevel, 2)) + 10;
            DoDamage?.Invoke(gameObject, damage);
            attackController.isAttacking = false;
        }
    }
示例#34
0
    protected virtual void Start()
    {
        controller       = GetComponent <Controller2D>();
        attackController = GetComponent <AttackController>();
        anim             = GetComponent <Animator>();
        sprite           = GetComponent <SpriteRenderer>();

        gravity         = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2);
        maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
        minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight);
    }
示例#35
0
    void Start()
    {
        playerStats = GameObject.FindGameObjectWithTag("Player").GetComponent <AttackController>();
        hearts      = new List <Image>();

        for (int i = 0; i < playerStats.maxHealth / 2; i++)
        {
            GameObject spawnedHeart = Instantiate(hearthObj, transform.position, Quaternion.identity, heartsContainer);
            hearts.Add(spawnedHeart.transform.Find("Img").GetComponent <Image>());
        }
    }
示例#36
0
    public virtual void CastLocalAttack()
    {
        isAttacking = true;

        AttackController attack = GetAttack();

        attack.Initialize(this);
        attack.SetMovement(directionX, attackSpeed, transform.position);

        StartCoroutine(WaitAttacking());
        AnimateAttack();
    }
示例#37
0
	void Awake()
	{
		mc = GetComponent<MoveController> ();
		ac = GetComponent<AttackController> ();
		tm = GetComponent<TeamMember> ();
		hp = GetComponent<Health> ();
		xp = GetComponent<Experience> ();
		an = GetComponent<Animator> ();
		rb = GetComponent<Rigidbody2D> ();
		sr = GetComponent<SpriteRenderer> ();
		bc = GetComponent<BoxCollider2D> ();

	}
     void Awake()
     {
          attackController = GetComponent<AttackController>();
          animator = GetComponent<Animator>();

          isMoving = false;
          movementVector = new Vector2(0, 0);
          direction = new Vector2(0, 0);
          facing = new Vector2(0, -1);
          previousFacing = new Vector2(0, -1);

          canDash = true;
          canMove = true;
          isDashing = false;
          dashIn = 0;
     }
     void OnTriggerEnter2D(Collider2D other)
     {
          if (other.gameObject.tag == "Player")
          {
               grabbed = true;
               attackController = other.gameObject.GetComponent<AttackController>();
               attackController.Ammo += ammoValue;

               Tweener tween = transform.DOMove(Camera.main.ScreenToWorldPoint(new Vector3(Camera.main.pixelWidth - 100, Camera.main.pixelHeight - 10)), 1, false)
                               .OnStepComplete(() =>
                               {
                                    Destroy(gameObject);
                               });
               //tween.OnUpdate(() => {
               //    tween.ChangeEndValue(new Vector3(Camera.main.pixelWidth - 100, Camera.main.pixelHeight - 10));
               //    Debug.Log("test");
               //});
          }
     }
     void Awake()
     {
          attackController = GetComponent<AttackController>();
          animator = GetComponent<Animator>();

          isMoving = false;
          movementVector = new Vector2(0, 0);
          facing = new Vector2(0, -1);
          previousFacing = new Vector2(0, -1);

          canDash = true;
          canMove = true;
          isDashing = false;
          dashIn = 0;
          IsInMenu = false;

          knockbackForce = 8;
          isKnockedBack = false;
          timeSpentKnockedBack = 0;
          knockBackTime = 0.12f;
          GameManager.Notifications.AddListener(this, "PlayerExitMenu");
          GameManager.Notifications.AddListener(this, "PlayerInMenu");
     }
示例#41
0
    /*
    void Awake()
    {
        if (player == null)
        {
            player = gameObject;
        }else if(player != gameObject)
        {
            Destroy(gameObject);
        }
    }*/
    void Start()
    {
        state = new StandingState();
        attackState = new IdleAttackState();
        animator = GetComponent<Animator>();
        skillManager = gameObject.AddComponent<SkillManager>();
        AttackCollider.SetActive(false);
        health = GetComponent<Health>();
        controller = GetComponent<MoveController>();
        crowdControllable = GetComponent<CrowdControllable>();
        mana = GetComponent<Mana>();
        attack = GetComponentInChildren<DealDamage>();
        defense = GetComponent<Defense>();
        attackController = GetComponent<AttackController>();
        gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2);
        jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
        audiosource = GetComponent<AudioSource>();

        initialRegenTime = 6;
        regenTick = 2;

        DontDestroyOnLoad(gameObject);

        skill[0] = null;
        skill[1] = null;
        skill[2] = null;
        skill[3] = null;
        threatLevel = damageDealt = 0;

        GetComponent<ID>().setTime(false);
        CCI = GameObject.Find("Main Process").GetComponentInChildren<Character_Class_Info>();
        si = GameObject.Find("Main Process").GetComponentInChildren<Skill_info>();
        Fully_Update();
    }
示例#42
0
 void Start()
 {
     myTeamId = GetComponent<TeamMember> ().teamId;
     atkController = GetComponent<AttackController> ();
     weapon = atkController.weapon;
 }
 public override void AddItemToInventory(Collider2D player, int value)
 {
      attackController = player.gameObject.GetComponent<AttackController>();
      attackController.Bombs += value;
 }
示例#44
0
 // Use this for initialization
 void Start()
 {
     this.controller  = GetComponent<CharacterController>();
     this.attackController = GetComponent<AttackController>();
     this.destPosition = transform.position;
 }
示例#45
0
 // Use this for initialization
 void Awake()
 {
     seeker = GetComponent<Seeker>();
     characterController = GetComponent<CharacterController>();
     attack = GetComponent<AttackController> ();
     animator = GetComponent<Animator>();
     hasTarget = false;
     status = Status.idle;
     callback = null;
 }
示例#46
0
 // Use this for initialization
 void Start()
 {
     //playerMove = this.GetComponent<MovementController>();
     playerAttack = this.GetComponent<AttackController>();
 }
示例#47
0
 // Use this for initialization
 void Start()
 {
     player = FindObjectOfType<Player>();
      playerHealth = player.GetComponent<Health>();
      playerAttackController = player.GetComponent<AttackController>();
 }
示例#48
0
 void Awake()
 {
     god = GameObject.FindGameObjectWithTag("God").GetComponent<UnifiedSuperClass>();
     skillsController = god.SkillsController;
     atkController = transform.root.GetComponentInChildren<AttackController>();
     //		Debug.Log(atkController.SecondSkillLock);
 }
    /// <summary>
    /// Creates the attack listing.
    /// </summary>
    /// <returns>The attack listing.</returns>
    /// <param name="atd">Atd.</param>
    protected AttackController.AttackData CreateAttackListing(AttackController.AttackData atd)
    {
        EditorGUILayout.BeginHorizontal ();
        atd.atk.showInEditor = EditorGUILayout.Foldout (atd.atk.showInEditor, atd.atk.attackName);
        if (GUILayout.Button ("-", GUILayout.Width (20), GUILayout.Height (14))) {
            ScriptableObject.DestroyImmediate (atd.atk);
            atd = null;
        }
        EditorGUILayout.EndHorizontal ();

        if (atd != null && atd.atk.showInEditor) {

            GUIStyle attacksStyle = new GUIStyle (GUI.skin.box);
            attacksStyle.padding = new RectOffset (12, 1, 5, 5);

            EditorGUILayout.BeginVertical (attacksStyle);

            // get all of the attack scripts
            int thisScriptIndex = 0;

            // get all of the attack scripts
            GUIContent attackScriptLabel = new GUIContent ("Attack Script",
                                                           "Attack Script\n" +
                                                           "The script the attack will be executing when the attack is used.");
            GUIContent[] attackScriptOptions = new GUIContent[AttackTypeList.Count];
            int index = 0;
            foreach (string key in AttackTypeList) {
                attackScriptOptions[index] = new GUIContent(key);
                if (atd.atk.GetType () == GetAttackType (key)) {
                    thisScriptIndex = index;
                }
                index++;
            }

            // list the attack scripts
            int tempAttackScriptIndex = EditorGUILayout.Popup (attackScriptLabel, thisScriptIndex, attackScriptOptions);
            if (tempAttackScriptIndex != thisScriptIndex) {
                Attack tempAtk = Instantiate (atd.atk);
                Attack newAtk = GetAttack (attackScriptOptions[tempAttackScriptIndex].text);
                atd.atk = Instantiate (newAtk);
                atd.atk.CopyComponents (tempAtk);
                ScriptableObject.DestroyImmediate (tempAtk);
                ScriptableObject.DestroyImmediate (newAtk);
            }

            // add the attack's components
            atd.atk.EditorGUISetup ();

            // add the attack inputs
            GUIStyle attacksInputStyle = new GUIStyle (GUI.skin.box);
            attacksInputStyle.padding = new RectOffset (12, 1, 1, 5);

            EditorGUILayout.Space ();
            EditorGUILayout.BeginHorizontal ();
            EditorGUILayout.LabelField ("Activation Parameters");
            EditorGUILayout.EndHorizontal ();

            EditorGUILayout.BeginVertical (attacksInputStyle);
            EditorGUILayout.BeginHorizontal ();
            GUIContent triggerLabel = new GUIContent ("Trigger",
                                                      "Trigger\n" +
                                                      "The option for a trigger that needs to happen in order for this attack to start.");
            AttackController.AttackTrigger tempTrigger = (AttackController.AttackTrigger) EditorGUILayout.EnumPopup (triggerLabel, atd.atkTrig);
            if (atd.atkTrig != tempTrigger) {
                atd.atkTrig = tempTrigger;
            }
            EditorGUILayout.EndHorizontal ();

            EditorGUILayout.BeginHorizontal ();
            GUIContent comboLabel = new GUIContent ("Combo Label",
                                                    "Combo Label\n" +
                                                    "If this attack is triggered after another attack, add it's ID here. Otherwise leave this section blank.");
            string tempComboID = EditorGUILayout.TextField (comboLabel, atd.comboStarterID);
            if (atd.comboStarterID != tempComboID) {
                atd.comboStarterID = tempComboID;
            }
            EditorGUILayout.EndHorizontal ();

            EditorGUILayout.BeginHorizontal ();

            // if there are no attack inputs
            if (atd.input.Count == 0) {
                AttackController.AttackInput ai = new AttackController.AttackInput ();
                ai.Pos = AttackController.AttackPositionState.Neutral;
                atd.input.Add (ai);
            }

            GUIContent posDirLabel = new GUIContent ("Position State and Input Directions",
                                                     "Position State\n" +
                                                     "The state the character's movement controller has to be in for this attack to activate.\n\n" +
                                                     "Input Direction\n" +
                                                     "The directional influence the attacker is using while in the selected position state.\n" +
                                                     "For a player this would be the joystick position when pressing the attack button.");
            EditorGUILayout.LabelField (posDirLabel);
            if (atd.input.Count < Enum.GetValues(typeof(AttackController.AttackPositionState)).Length) {
                if (GUILayout.Button ("+", GUILayout.Width (20), GUILayout.Height (14))) {
                    AttackController.AttackInput ai = new AttackController.AttackInput ();
                    if (atd.InputContains (AttackController.AttackPositionState.Neutral) == -1) {
                        ai.Pos = AttackController.AttackPositionState.Neutral;
                    } else if (atd.InputContains (AttackController.AttackPositionState.Dash) == -1) {
                        ai.Pos = AttackController.AttackPositionState.Dash;
                    } else if (atd.InputContains (AttackController.AttackPositionState.Air) == -1) {
                        ai.Pos = AttackController.AttackPositionState.Air;
                    }
                    atd.input.Add (ai);
                }
            }
            EditorGUILayout.EndHorizontal ();

            // add the attack inputs
            for (int posIndex = 0; posIndex < atd.input.Count; posIndex++) {

                EditorGUILayout.BeginHorizontal ();
                GUIContent posStateLabel = new GUIContent ("Input",
                                                           "Input\n" +
                                                           "An input necessary to perform this attack.");
                atd.input[posIndex].showData = EditorGUILayout.Foldout (atd.input[posIndex].showData, posStateLabel);
                AttackController.AttackPositionState tempAttackPosition = (AttackController.AttackPositionState) EditorGUILayout.EnumPopup (atd.input[posIndex].Pos);
                if (atd.input[posIndex].Pos != tempAttackPosition && atd.InputContains (tempAttackPosition) == -1) {
                    atd.input[posIndex].Pos = tempAttackPosition;
                }
                if (GUILayout.Button ("-", GUILayout.Width (20), GUILayout.Height (14))) {
                    atd.input.RemoveAt (posIndex);
                    break;
                }
                EditorGUILayout.EndHorizontal ();

                if (atd.input[posIndex].showData) {
                    for (int dirIndex = 0; dirIndex < Enum.GetValues(typeof(AttackController.AttackDirection)).Length; dirIndex++) {
                        EditorGUILayout.BeginHorizontal ();
                        if (atd.input[posIndex].Dir.Contains ((AttackController.AttackDirection)dirIndex)) {
                            bool tempDir = EditorGUILayout.ToggleLeft (((AttackController.AttackDirection)dirIndex).ToString (), true);
                            if (!tempDir) {
                                int dir = atd.input[posIndex].Dir.IndexOf ((AttackController.AttackDirection)dirIndex);
                                atd.input[posIndex].Dir.RemoveAt (dir);
                                break;
                            }
                        } else {
                            bool tempDir = EditorGUILayout.ToggleLeft (((AttackController.AttackDirection)dirIndex).ToString (), false);
                            if (tempDir) {
                                atd.input[posIndex].Dir.Add ((AttackController.AttackDirection)dirIndex);
                                break;
                            }
                        }
                        EditorGUILayout.EndHorizontal ();
                    }
                }

            }

            EditorGUILayout.EndVertical ();

            EditorGUILayout.EndVertical ();
        }

        return atd;
    }
示例#50
0
 // Use this for initialization
 void Start()
 {
     this.controller  = GetComponent<CharacterController>();
     this.attackController = GetComponent<AttackController>();
     this.target = transform.position;
     this.isDead = false;
 }